/**
 * Project Name:EMSInterfaceTest
 * File Name:PrepartSheetSatatus.java
 * Package Name:functions.mams_rest
 * Date:2018年7月26日下午6:34:24
 * Copyright (c) 2018, crpcg@crpcg.com All Rights Reserved.
 *
 */

package functions.mams_rest;
/**
 * ClassName:PrepartSheetSatatus <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason:	 TODO ADD REASON. <br/>
 * Date:     2018年7月26日 下午6:34:24 <br/>
 * @author   JiangWu	 
 */

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;

import com.beans.VendorTypeBean;

import coms.Constants;
import frame.HttpHelper;
import frame.InterTest;

public class PrepartSheetSatatus implements InterTest{
	String result;
	List<VendorTypeBean> prepartSheetBeans;
	
	public PrepartSheetSatatus() {
	}
	
	/*
	 * PREPARE_SHEET_STATUS_url="/mams-rest/sys/valueset/item/list/PREPARE_SHEET_STATUS"
	 */
	public void prepartSheetSatatus(){
		String url = Constants.PREPARE_SHEET_STATUS_URL;
		try {
			result = HttpHelper.post("", url);
			JSONObject jsonObject = new JSONObject(result);
			String statusCode = jsonObject.getString("statusCode");
			String mString = jsonObject.getString("msg");
			if(statusCode.equals("0")) {
				JSONArray jsonArray = jsonObject.getJSONArray("dataResult");
				prepartSheetBeans = new ArrayList<VendorTypeBean>();
				for(int i=0;i<jsonArray.length();i++) {
					JSONObject data = jsonArray.getJSONObject(i);
					String vsiId = data.getString("vsiId");
					String vsiKey = data.getString("vsiKey");
					String vsiValue = data.getString("vsiValue");
					VendorTypeBean vendorTypeBean = new VendorTypeBean(vsiId, vsiKey, vsiValue);
					prepartSheetBeans.add(vendorTypeBean);
				}
			}else {
				System.out.println(mString);
			}
		} catch (Exception e) {
			
			// TODO Auto-generated catch block
			e.printStackTrace();
			
		}
	}

	
	/**
	 * TODO 简单描述该方法的实现功能（可选）.
	 * @see frame.InterTest#run(java.util.HashMap)
	 */
	@Override
	public void run(Map<Object, Object> paramMap) {
	  prepartSheetSatatus();
		// TODO Auto-generated method stub
		
	}

  @Override
  public boolean getStatus() {
    // TODO Auto-generated method stub
    return false;
  }

  @Override
  public String getRemark() {
    // TODO Auto-generated method stub
    return null;
  }
}

